/**
*  用户管理
 */
<template>
  <div class="page-box h100 display-flex czbj">
    <dxtable
      :dataJson="dataJson"
      :portUrl="portUrl"
      :formJson="formJson"
      :qx="qx"
      :extra="extra"
    ></dxtable>
  </div>
</template>
 <script lang='ts' setup>
import { leixing } from "../../../util/config";
import dxtable from "../../../components/util/dxtable.vue";
import { dxget } from "../../../util/index";
import { h, ref, reactive } from "vue";
let qxList = ref([]);
let dataJson = reactive([
  {
    title: "id",
    key: "id",
    width: 60,
  },
  {
    title: "头像",
    key: "headPortrait",
    type: "img", //类型
  },
  {
    title: "用户账号",
    key: "userNmae",
    search: true, // 是否在搜索栏展示
  },
  {
    title: "用户名称",
    key: "userNickname",
    search: true, // 是否在搜索栏展示
  },
  {
    title: "手机号码",
    key: "phone",
    required: true, // 是否为必填
  },
  {
    title: "所在管理组",
    key: "CharacterNameCode",
    search: true, // 是否在搜索栏展示
    type: "select",
    options: [],
    render(row) {
      try {
        let ql = qxList.value.filter((a) => a.id == row.CharacterNameCode);
        return ql[0].name;
      } catch (e) {
        return "";
      }
    },
  },
  {
    title: "账号状态",
    key: "AccountStatus",
    search: true, // 是否在搜索栏展示
    type: "select",
    options: [
      {
        label: "全部",
        value: "",
      },
      {
        label: "启用",
        value: "1",
      },
      {
        label: "禁用",
        value: "0",
      },
    ],
    render(row) {
      let jhse = "禁用";
      if (row.AccountStatus == 1) {
        jhse = "启用";
      }
      return jhse;
    },
  },

  {
    title: "账号创建时间",
    key: "addTime",
  },
  {
    title: "登录ip",
    key: "loadIp",
  },
]);
let extra = { accountType: 1 };
const qx = {
  DeletePermissionID: "mentuserManagementdel", //删除
  EditPermissionIdentifier: "mentuserManagementbj", // 编辑
  NewPermissionIdentifier: "mentuserManagementxz", // 新建
  ViewPermissionID: "mentuserManagementck", // 查看
};
// const portUrl = "dxgjAdmin/administrator?CharacterNameCode=" + leixing;
const portUrl = "dxgjAdmin/administrator?accountType=1";
let formJson = reactive([
  {
    title: "用户账号",
    type: "input",
    key: "userNmae",
    required: true, // 是否为必填
  },
  {
    title: "用户密码",
    type: "password",
    key: "userPassword",
    required: true, // 是否为必填
  },
  {
    title: "用户姓名",
    key: "userNickname",
    type: "input",
    required: true, // 是否为必填
  },
  {
    title: "手机号码",
    key: "phone",
    type: "input",
    required: true, // 是否为必填
  },
  {
    title: "所在管理组",
    type: "select",
    key: "CharacterNameCode",
    val: 3,
    required: true, // 是否为必填
    options: [],
  },
  {
    title: "头像",
    key: "headPortrait",
    type: "img", //类型
    oijert: "用户头像",
    required: true, // 是否为必填
  },
]);
let optionsSele = [
  {
    label: "全部",
    value: "",
  },
];
const getSelect = async () => {
  let { data }: any = await dxget("beRelieved/groupmanagement");
  data.map((a) => {
    optionsSele.push({
      label: a.name,
      value: a.id,
    });
  });
  formJson[4].options = optionsSele;
  dataJson[5].options = optionsSele;
  qxList.value = data;
};
getSelect();
</script>
 <style scoped>
</style>